<template>
  <div class="mod-user">
<!-- 资质项详情 -->
    <div class="xinxi">
        <!-- 资质信息 -->
       <div class="zizhixinxi">
           <div class="zizhi-title">
            <div class="zuo-a"></div>
            <div class="you-a">资质信息</div>
           </div>

        <div class="zizhi-center">

        <el-form :model="ruleForm" :rules="ruleRule" ref="ruleForm"  label-width="120px">

        <el-row>

         <el-col :span="24">
                <el-form-item label="资质类型">
                <el-radio v-model="ruleForm.typeTag" :label="1">总承包</el-radio>
                <el-radio v-model="ruleForm.typeTag" :label="2">专业承包</el-radio>
                </el-form-item>
              </el-col>


         <el-col :span="12">
                <el-form-item label="资质项" prop="qualiCode">
<!--                  <el-select class="input-e" v-model="ruleForm.qualiCode" @change="changeLevels()" placeholder="请选择">
                 <el-option
                   v-for="item in aptitudeList"
                   :key="item.code"
                   :label="item.name"
                   :value="item.code">
                 </el-option>
               </el-select>-->
                  <el-input class="input-e" v-model="ruleForm.qualiCode" placeholder="请输入资质项"></el-input>
                </el-form-item>
              </el-col>


         <el-col :span="12">
                <el-form-item label="资质等级" prop="gradeTag">
                <el-select class="input-e" v-model="ruleForm.gradeTag" placeholder="请选择">
                 <el-option
                   v-for="item in levels"
                   :key="item.num"
                   :label="item.level"
                   :value="item.num">
                 </el-option>
               </el-select>
                </el-form-item>
              </el-col>

                <el-col :span="12">
                <el-form-item label="状态" prop="statusFlag">
                  <el-select class="input-e" v-model="ruleForm.statusFlag" placeholder="请选择">
                         <el-option
                           v-for="item in zhuangtai"
                           :key="item.value"
                           :label="item.name"
                           :value="item.value">
                         </el-option>
                       </el-select>
                </el-form-item>
              </el-col>


         <el-col :span="12">
                <el-form-item label="排序号">
                    <el-input-number class="input-e" v-model="ruleForm.orderNum" :min="0" :max="10" label="排序"></el-input-number>

                </el-form-item>
              </el-col>

        </el-row>

        </el-form>


        </div>

       </div>

    </div>

    <!-- 所需证书 -->
     <div class="xinxi-e">
        <!-- 资质信息 -->
       <div class="zizhixinxi">
           <div class="zizhi-titleA">
            <div class="zuo-a"></div>
            <div class="you-a">所需证书</div>
            <el-button @click="clickXinzeng" class="button-ee" type="primary">新 增</el-button>
     </div>



  <el-table
    :data="tableData"
    class="tables-e"
    style="width: 100%"
    :header-cell-style="{background:'#F5F7FA',height:'54px'}"
    >
    <el-table-column
      type="index"
      label="序号"
      align="center"
      width="150">
    </el-table-column>
    <el-table-column
      prop="content"
      label="证书信息"
      align="center"
      >
    </el-table-column>
    <el-table-column
      prop="address"
      label="操作"
      width="150"
      align="center"
      >
      <template slot-scope="scope">
        <el-button @click="handleClickModification(scope.row)" type="text" size="small">修改</el-button>
        <el-button @click="handleClickDelete(scope.row.id)" type="text" size="small">删除</el-button>
      </template>
    </el-table-column>
  </el-table>

       </div>

    </div>


     <div class="xinxi-e">
        <!-- 文章信息 -->
       <div class="zizhixinxiA">
           <div class="zizhi-titleA">
            <div class="zuo-a"></div>
            <div class="you-a">文章内容</div>
       </div>

       </div>

<!-- bianjiqi -->
       <div class="wenzhang">

         <el-upload
            class="upload-intelligent"
            name="file"
            :headers="myHeader"
            list-type="picture"
            :action="uploadUrls()"
            :show-file-list="false"
            :multiple="false"
            :before-upload="beforeAvatarUpload"
            :on-error="onError"
            :on-success="onSuccess"
            >
          </el-upload>
     <quill-editor class="editor"
                    ref="myQuillEditor"
                    v-model="ruleForm.articleContent"
                    :options="editorOption"
                    @blur="onEditorBlur($event)"
                    @focus="onEditorFocus($event)"
                    @ready="onEditorReady($event)"
                    @change="onEditorChange($event)">
      </quill-editor>


       </div>

    <div class="queding">
        <div class="button-e">

          <div @click="clickUa" class="button-ua">取 消</div>
          <div @click="clickUb" class="button-ub">确 定</div>

        </div>
    </div>


    </div>




  <el-dialog
  title="新增"
  :visible.sync="policyCenterDialogVisible"
  width="60%"
  >
  <span>
    <!-- 表单 -->
  <el-form :model="dataForm" :rules="dataRule" status-icon ref="dataForm" label-width="150px" class="demo-ruleForm formA">

                <el-form-item label="证书类型">
                  <el-select v-model="dataForm.typeCode" filterable placeholder="请选择证书类型" style="width:100%" @change="jobChange">
                      <el-option
                        v-for="item in jobs"
                        :key="item.id"
                        :label="item.name"
                        :value="item.code">
                      </el-option>
                  </el-select>
                </el-form-item>

                 <el-form-item label="证书类别">
                  <el-select v-model="dataForm.categoryCode" filterable placeholder="请选择证书类别" style="width:100%" @change="confChange">
                    <el-option
                      v-for="item in confInfos"
                      :key="item.id"
                      :label="item.name"
                      :value="item.value">
                    </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="证书专业">
                  <el-select v-model="dataForm.professionCode" filterable placeholder="请选择证书专业" style="width:100%">
                      <el-option
                        v-for="item in professions"
                        :key="item.label"
                        :label="item.label"
                        :value="item.value">
                      </el-option>
                  </el-select>
                </el-form-item>

  <el-form-item label="数量 （本）">
    <el-input-number v-model="dataForm.amount" :min="0" :max="100" label="数量"></el-input-number>
    <el-checkbox class="checkbox-A" v-model="completeFlagE" label="专业齐全" border size="medium"></el-checkbox>
  </el-form-item>

  <el-form-item label="条件补充">
  <el-radio v-model="dataAgg.condTag" :label="2">或</el-radio>
  <!-- <el-radio v-model="ruleForm.type" :label="2">且</el-radio> -->
  </el-form-item>

                <el-form-item label="证书类型">
                  <el-select v-model="dataFormA.typeCode" filterable placeholder="请选择证书类型" style="width:100%" @change="jobChangeA">
                      <el-option
                        v-for="item in jobsA"
                        :key="item.code"
                        :label="item.name"
                        :value="item.code">
                      </el-option>
                  </el-select>
                </el-form-item>

                 <el-form-item label="证书类别">
                  <el-select v-model="dataFormA.categoryCode" filterable placeholder="请选择证书类别" style="width:100%" @change="confChangeA">
                    <el-option
                      v-for="item in confInfosA"
                      :key="item.value"
                      :label="item.name"
                      :value="item.value">
                    </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="证书专业">
                  <el-select v-model="dataFormA.professionCode" filterable placeholder="请选择证书专业" style="width:100%">
                      <el-option
                        v-for="(item,index) in professionsA"
                        :key="index"
                        :label="item.label"
                        :value="item.value">
                      </el-option>
                  </el-select>
                </el-form-item>

  <el-form-item label="数量 （本）">
    <el-input-number  v-model="dataFormA.amount" :min="0" :max="100" label="数量"></el-input-number>
    <el-checkbox class="checkbox-A" v-model="completeFlagA" label="专业齐全" border size="medium"></el-checkbox>
  </el-form-item>


  <el-form-item label="备注">
   <el-input
   type="textarea"
   :rows="2"
   placeholder="请输入备注"
   v-model="dataAgg.explain">
   </el-input>
  </el-form-item>




</el-form>
  </span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="clickFalseLink">取 消</el-button>
    <el-button type="primary" plain @click="clickNewlyLink()">确 定</el-button>
  </span>
</el-dialog>
  </div>
</template>
<script>

import Vue from 'vue'
export default {
  data () {
    return {
    myHeader: {
          'token': Vue.cookie.get('token')
        },
    checked3:false,
    indexEE:false,
    policyCenterDialogVisible:false,
    ruleForm:{
	id: '',
	typeTag: 1,
	qualiCode: "",
	gradeTag: '',
	statusFlag: 1,
	orderNum: 1,
	articleContent: "",
	certCondIds: []
    },

    dataForm:{
      completeFlag:0,
      typeCode:'',
      categoryCode:'',
      professionCode:'',
      amount:1
    },
    dataFormA:{
      completeFlag:0,
      typeCode:'',
      categoryCode:'',
      professionCode:'',
      amount:1
    },
    completeFlagA:false,
    completeFlagE:false,

    dataAgg:{
    certInfos:[],
    id: '',
	  condTag: 2,
	  explain: ""
    },
    articleData:{
          content:''
        },
    certIdsA:{
      certIds:[]
    },
    tableData:[],
    jobs: [],
    professions: [],
    confInfos: [],
    jobsA: [],
    professionsA: [],
    confInfosA: [],
    aptitudeList:[],
    levels:[{
      num:0,
      level:'特级'
    },{
      num:1,
      level:'一级'
    },{
      num:2,
      level:'二级'
    },{
      num:3,
      level:'三级'
    },{
      num:4,
      level:'不分等级'
    }],
    zhuangtai:[
    {
      name:'有效',
      value:1
    },
    {
      name:'无效',
      value:2
    },
    ],
    editorOption: {
              modules: {
                toolbar: {
                  container: [
                        ["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
                        ["blockquote", "code-block"], // 引用  代码块
                        [{ header: 1 }, { header: 2 }], // 1、2 级标题
                        [{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
                        [{ script: "sub" }, { script: "super" }], // 上标/下标
                        [{ indent: "-1" }, { indent: "+1" }], // 缩进
                        // [{'direction': 'rtl'}],                         // 文本方向
                        [{ size: ["small", false, "large", "huge"] }], // 字体大小
                        [{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
                        [{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
                        [{ font: [] }], // 字体种类
                        [{ align: [] }], // 对齐方式
                        ["clean"], // 清除文本格式
                        ["link", "image", "video"] // 链接、图片、视频
                      ], //工具菜单栏配置
                      handlers: {
                        image: function(value) {
                          if (value) {
                            // 触发input框选择图片文件
                            document.querySelector(".el-upload input").click();
                          } else {
                            this.quill.format("image", false);
                          }
                        },
                        // link: function(value) {
                        //   if (value) {
                        //     var href = prompt('请输入url');
                        //     this.quill.format("link", href);
                        //   } else {
                        //     this.quill.format("link", false);
                        //   }
                        // },
                      }
                }

              },
              placeholder: '请在这里添加文章详细描述', //提示
              readyOnly: false, //是否只读
              theme: 'snow', //主题 snow/bubble
              syntax: true, //语法检测
      },
   dataRule:{
   typeCode: [
     { required: true, message: '请选择', trigger: 'blur' }
   ],
   categoryCode: [
     { required: true, message: '请选择', trigger: 'blur' }
   ],
   professionCode: [
   { required: true, message: '请选择', trigger: 'blur' }
   ],

   },

   ruleRule:{
   qualiCode: [
     { required: true, message: '请选择', trigger: 'blur' }
   ],
   gradeTag:[
     { required: true, message: '请选择', trigger: 'blur' }
   ],
   statusFlag:[
     { required: true, message: '请选择', trigger: 'blur' }
   ]
   },

    }
  },
  props:{
    dataListEdit:{
      type:Object
    }
  },
  components:{

  },
  computed: {
       editor() {
            return this.$refs.myTextEditor.quillEditor;
          }
    },
  created(){
    this.getaptitude()


    this.dataListForms()


  },
    watch: {
      articleData: {
        deep: true,
        handler(val){
          // console.log(val)
          if(val.content){
            var gt = new RegExp('&gt;', 'g')
            var lt = new RegExp('&lt;', 'g')
            val.content = val.content.replace(gt, '>')
            val.content = val.content.replace(lt, '<')
          }
        }
      }
    },
  methods:{

      dataListForms(){
      if(this.dataListEdit.qualiCode){
        // this.ruleForm = {...this.ruleForm, ...this.dataListEdit}

        this.ruleForm.id = this.dataListEdit.id
        this.ruleForm.typeTag = this.dataListEdit.typeTag
        this.ruleForm.qualiCode = this.dataListEdit.qualiCode
        this.ruleForm.gradeTag = this.dataListEdit.gradeTag
        this.ruleForm.statusFlag = this.dataListEdit.statusFlag
        this.ruleForm.orderNum = this.dataListEdit.orderNum
        this.ruleForm.articleContent = this.dataListEdit.articleContent
        this.tableData = this.dataListEdit.certConds
      }
      },

  /* 文本编辑器 S */
      uploadUrls(){
        return this.$http.adornUrl(`/certificate/certificateInfo/upload`)
     },
           onSuccess(res, file, fileList){
        // res为图片服务器返回的数据
        // 获取富文本组件实例
        // console.log(res)
        window.setTimeout(() => {
          let quill = this.$refs.myQuillEditor.quill;
        // 如果上传成功
        if (res.code == 0) {
          // 获取光标所在位置
          let length = quill.getSelection().index;
          // 插入图片  res.url为服务器返回的图片地址
          quill.insertEmbed(length, "image", res.remoteUrl + res.fileName)
          // 调整光标到最后
          quill.setSelection(length + 1);
        } else {
          this.$message.error("图片插入失败");
        }
        // loading动画消失
        this.quillUpdateImg = false;
        },0)
      },
      beforeAvatarUpload(file) {
     this.quillUpdateImg = true;
     },
     onError(err, file, fileList){
       // loading动画消失
        this.quillUpdateImg = false;
        this.$message.error("图片插入失败");
    },
          // 失去焦点
          onEditorBlur(editor) {},
          // 获得焦点
          onEditorFocus(editor) {},
          // 开始
          onEditorReady(editor) {},
          // 值发生变化
          onEditorChange(editor) {
            this.content = editor.html;
            // console.log(editor);
          },
  /* 文本编辑器 E */

  /* h获取资质项 */
getaptitude(){
    this.$http({
      url: this.$http.adornUrl(`/sys/quali/select/list`),
      method: 'get'
    }).then(({data}) => {
      if (data.code === 0) {
        this.aptitudeList = data.data
      if(this.dataListEdit.qualiCode){
      // this.changeLevels(
    }
      } else {
        this.$message.error(data.msg)
      }
    })
},
changeLevels(){
  this.levels = []

  console.log(1213123);
  console.log(this.aptitudeList);

this.aptitudeList.forEach(i =>{
  if(i.code == this.ruleForm.qualiCode){
    this.levels = i.levels
  }
})

},
/* 新增 */
clickXinzeng() {
this.initJobs()
this.indexEE = false
this.policyCenterDialogVisible = true
this.dataAgg = {
    certInfos:[],
    id: '',
	  condTag: 2,
	  explain: ""
}
this.completeFlagA = false
this.completeFlagE = false
this.dataForm = {
      completeFlag:0,
      typeCode:'',
      categoryCode:'',
      professionCode:'',
      amount:1
    }
this.dataFormA = {
  completeFlag:0,
  typeCode:'',
  categoryCode:'',
  professionCode:'',
  amount:1
}

},
removeArray(arr, val) {

   for(var i = 0; i < arr.length; i++) {

    if(arr[i] == val) {

     arr.splice(i, 1);

     break;

    }

   }

  },
  // 删除
  handleClickDelete(id){
    console.log(id);
  this.$http({
        url: this.$http.adornUrl(`/sys/quali/cert/delete/`+id),
        method: 'get',
      }).then(({data}) => {
        if (data.code === 0) {
          this.$message.success('删除成功')

          this.tableData.forEach((i,index)=>{
            if(i.id == id){
              this.removeArray(this.tableData, i);
            }
          })

        } else {
          this.$message.error(data.msg)
        }
      })
  },

     /* 修改 */
   handleClickModification(row){
     console.log(this.tableData);
     console.log(row);
  //  console.log(id);
     this.indexEE = true
     this.dataAgg.id = row.id
	   this.dataAgg.condTag = row.condTag,
	   this.dataAgg.explain = row.explain
     this.dataAgg.certInfos = []
     this.dataForm = row.certInfos[0]
     if(row.certInfos.length > 1){
     this.dataFormA = row.certInfos[1]
     }

     if(this.dataFormA.completeFlag == 1){
       this.completeFlagA == true
     }
     if(this.dataFormA.completeFlag == 0){
       this.completeFlagA == false
     }
     if(this.dataForm.completeFlag == 1){
       this.completeFlagE == true
     }
     if(this.dataForm.completeFlag == 0){
       this.completeFlagE == false
     }


     this.initJobs()
     this.jobChange()
     this.confChange()
     this.jobChangeA()
     this.confChangeA()
     this.policyCenterDialogVisible = true

   },

clickNewlyLink(){

if(this.dataForm.typeCode !== ''){
this.dataAgg.certInfos.push(this.dataForm)
}

if(this.completeFlagA == true){
  this.dataFormA.completeFlag = 1
}
if(this.completeFlagA == false){
  this.dataFormA.completeFlag = 0
}

if(this.completeFlagE == true){
  this.dataForm.completeFlag = 1
}
if(this.completeFlagE == false){
  this.dataForm.completeFlag = 0
}

if(this.dataFormA.typeCode !== ''){
this.dataAgg.certInfos.push(this.dataFormA)
}


    if(!this.indexEE){
      this.$refs['dataForm'].validate((valid) => {
          if(valid){
           this.$http({
              url: this.$http.adornUrl(`/sys/quali/cert/add`),
              method: 'post',
              data: this.$http.adornData(this.dataAgg)
            }).then(({data}) => {
              if (data && data.code === 0) {

                this.tableData.push(data.data)
                this.$message({
                  message: '添加成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.policyCenterDialogVisible = false
                    // this.getPolicyList()
                    // this.$refs.ruleForm.resetFields()
                  }
                })
              } else {
                this.$message.error(data.msg)
                this.dataAgg = {
                               certInfos:[],
                               id: '',
	                             condTag: 2,
	                             explain: ""
                               }
                // this.$refs.ruleForm.resetFields()
              }
            })
            }
      })
    } else {
          this.$refs['dataForm'].validate((valid) => {
          if(valid){
           this.$http({
              url: this.$http.adornUrl(`/sys/quali/cert/edit`),
              method: 'post',
              data: this.$http.adornData(this.dataAgg)
            }).then(({data}) => {
              if (data && data.code === 0) {

                this.tableData.forEach((i,index)=>{
                  if(i.id == data.data.id){
                    this.tableData[index] = data.data
                    this.$set(this.tableData,index,data.data)

                  }
                })





                this.$message({
                  message: '修改成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.policyCenterDialogVisible = false
                    // this.getPolicyList()
                    // this.$refs.ruleForm.resetFields()
                  }
                })
              } else {
                this.$message.error(data.msg)
                this.dataAgg = {
                               certInfos:[],
                               id: '',
	                             condTag: 2,
	                             explain: ""
                               }
                // this.$refs.ruleForm.resetFields()
              }
            })
            }
      })
    }






},
clickFalseLink(){
  this.policyCenterDialogVisible = false
  this.$refs.ruleForm.resetFields()

  // this.
},
/* 获取证书大类 */
 initJobs() {
   this.$http({
     url: this.$http.adornUrl('/certificate/certificateInfo/getJobs'),
     method: 'get',
     params: {}
   }).then(({data}) => {
     if (data && data.length > 0) {
       this.jobs = data
       this.jobsA = data
     }
   })
 },
 jobChange(value){
      this.confInfos = []
      this.professions = []
      // this.dataForm.idType = ''
      // this.dataForm.profession = ''
      this.$http({
        url: this.$http.adornUrl('/certificate/certificateInfo/getJobsConf'),
        method: 'get',
        params: this.$http.adornParams({
                'type': this.dataForm.typeCode
              })
      }).then(({data}) => {
        if (data && data.length > 0) {
          this.confInfos = data
        }
      })
  },
 confChange(value){

        this.professions = []
          // value = this.dateFrom.idType
        this.$http({
          url: this.$http.adornUrl('/certificate/certificateInfo/getJobsConf'),
          method: 'get',
          params: this.$http.adornParams({
                  'type': this.dataForm.categoryCode
                })
        }).then(({data}) => {
          if (data && data.length > 0) {
            this.professions = data
          }
        })

 },
  jobChangeA(value){
      this.confInfosA = []
      this.professionsA = []
      // this.dataForm.idType = ''
      // this.dataForm.profession = ''
      this.$http({
        url: this.$http.adornUrl('/certificate/certificateInfo/getJobsConf'),
        method: 'get',
        params: this.$http.adornParams({
                'type': this.dataFormA.typeCode
              })
      }).then(({data}) => {
        if (data && data.length > 0) {
          this.confInfosA = data
        }
      })
  },
 confChangeA(value){

        this.professionsA = []
          // value = this.dateFrom.idType
        this.$http({
          url: this.$http.adornUrl('/certificate/certificateInfo/getJobsConf'),
          method: 'get',
          params: this.$http.adornParams({
                  'type': this.dataFormA.categoryCode
                })
        }).then(({data}) => {
          if (data && data.length > 0) {
            this.professionsA = data
          }
        })

 },

      clickUa(){

      if(!this.dataListEdit.qualiCode){
       this.tableData.forEach(i=>{
        this.certIdsA.certIds.push(i.id)
      })

      this.dataAgg = {
      certInfos:[],
      id: '',
	    condTag: 2,
	    explain: ""
      }

      this.completeFlagA = false
      this.completeFlagE = false


      this.dataFormA = {
      completeFlag:0,
      typeCode:'',
      categoryCode:'',
      professionCode:'',
      amount:1
      }

      this.dataForm = {
      completeFlag:0,
      typeCode:'',
      categoryCode:'',
      professionCode:'',
      amount:1
      }


      this.$http({
              url: this.$http.adornUrl(`/sys/quali/cert/delete/batch`),
              method: 'post',
              data: this.$http.adornData(this.certIdsA)
            }).then(({data}) => {
              if (data && data.code === 0) {

                this.tableData = []

              } else {

                // this.$refs.ruleForm.resetFields()
              }
            })
      }

      this.dataAgg = {
      certInfos:[],
      id: '',
	    condTag: 2,
	    explain: ""
      }

      this.completeFlagA = false
      this.completeFlagE = false


      this.dataFormA = {
      completeFlag:0,
      typeCode:'',
      categoryCode:'',
      professionCode:'',
      amount:1
      }

      this.dataForm = {
      completeFlag:0,
      typeCode:'',
      categoryCode:'',
      professionCode:'',
      amount:1
      }

      this.$parent.clickBacks();
      },
      clickUb(){

        if(!this.dataListEdit.qualiCode){

         this.tableData.forEach( i =>{
            this.ruleForm.certCondIds.push(i.id)
         })

         console.log(this.ruleForm);

          this.$refs['ruleForm'].validate((valid) => {
          if(valid){
           this.$http({
              url: this.$http.adornUrl(`/sys/quali/add`),
              method: 'post',
              data: this.$http.adornData(this.ruleForm)
            }).then(({data}) => {
              if (data && data.code === 0) {

                this.$message({
                  message: '添加成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {

                    this.$parent.clickBacks();

                          this.dataAgg = {
                          certInfos:[],
                          id: '',
	                        condTag: 2,
	                        explain: ""
                          }

                          this.completeFlagA = false
                          this.completeFlagE = false


                          this.dataFormA = {
                          completeFlag:0,
                          typeCode:'',
                          categoryCode:'',
                          professionCode:'',
                          amount:1
                          }

                          this.dataForm = {
                          completeFlag:0,
                          typeCode:'',
                          categoryCode:'',
                          professionCode:'',
                          amount:1
                          }
                    // this.getPolicyList()
                    // this.$refs.ruleForm.resetFields()
                  }
                })
              } else {
                this.$message.error(data.msg)
                // this.$refs.ruleForm.resetFields()
              }
            })
            }
      })

        }else{

          console.log(this.tableData);

        this.tableData.forEach(i=>{
           this.ruleForm.certCondIds.push(i.id)
        })
        console.log(this.ruleForm.certCondIds);


        console.log(this.ruleForm);

          this.$refs['ruleForm'].validate((valid) => {
          if(valid){
           this.$http({
              url: this.$http.adornUrl(`/sys/quali/edit`),
              method: 'post',
              data: this.$http.adornData(this.ruleForm)
            }).then(({data}) => {
              if (data && data.code === 0) {

                this.$message({
                  message: '修改成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {

                    this.$parent.clickBacks();

                          this.dataAgg = {
                          certInfos:[],
                          id: '',
	                        condTag: 2,
	                        explain: ""
                          }

                          this.completeFlagA = false
                           this.completeFlagE = false


                          this.dataFormA = {
                          completeFlag:0,
                          typeCode:'',
                          categoryCode:'',
                          professionCode:'',
                          amount:1
                          }

                          this.dataForm = {
                          completeFlag:0,
                          typeCode:'',
                          categoryCode:'',
                          professionCode:'',
                          amount:1
                          }
                    // this.getPolicyList()
                    // this.$refs.ruleForm.resetFields()
                  }
                })
              } else {
                this.$message.error(data.msg)
                // this.$refs.ruleForm.resetFields()
              }
            })
            }
      })

        }


      },

}
}
</script>
<style scoped lang="scss">
  .inputcss{
  width: 300px;
  margin-right: 5px;
  }
  .policyForm{
    margin-top: 10px;
  }
  .mod-user{
    padding: 15px;
}

/deep/.el-dialog__wrapper{
.el-dialog{
.el-dialog__header{
    font-weight: bold;
    padding-bottom:20px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
}

}
.formA{
    padding-right: 100px !important;
}
.selectA{
    width: 100% !important;
}
.div-tab{
    width: 100%;
    height: 40px;
    background-color: #ffffff;
}
/deep/.tabs-s .el-tabs__header .el-tabs__nav-wrap .el-tabs__nav-scroll .el-tabs__nav .el-tabs__item {
    border-right: none !important;
    border-left: none !important;
    background-color: #ffffff !important;
}
/deep/.tabs-s .el-tabs__active-bar {
    height: 2px !important;
}
.table-eee{
    margin-top: 10px;
}
.xinxi{
    width: 100%;
    padding: 25px;
    background-color: #ffffff;
}

.zizhixinxi{
    width: 100%;
    border-bottom: 1px solid #E9E9E9;
}
.zizhixinxiA{
    width: 100%;
}
.zizhi-title{
    width: 100%;
    height: 18px;
}
.zizhi-titleA{
    width: 100%;
    height: 31px;
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.zuo-a{
    width: 5px;
    height: 18px;
    float: left;
    background-color: #6E92E9;
}
.you-a{
    margin-left: 8px;
    float: left;
    font-size: 16px;
    color: #000000;
    font-weight: bold;
}
.zizhi-center{
    width: 100%;
    height: 210px;
    padding-top: 20px;
    // background-color: #6E92E9;
}
.input-e{
    width: 75%;
}
.xinxi-e{
    padding:0 25px 25px 25px;
    width: 100%;
    background-color: #ffffff;
}
.button-ee{
    width: 62px;
    height: 31px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    position: absolute;
    right: 0px;
    float: right;
}
.tables-e{
    margin-bottom: 25px;
}
.wenzhang{
    width: 100%;
    height: 560px;
    background-color: #ffffff;
}
.queding{
    width: 100%;
    height: 32px;
    margin-top: 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
}
.button-e{
    width: 140px;
    height: 32px;
}
.button-ua{
width: 63px;
height: 30px;
float: left;
background: #ffffff;
color: #000000;
cursor: pointer;
opacity: 1;
border-radius: 2px;
display: flex;
justify-content: center;
align-items: center;

border: 1px solid #E8E8E8;
}
.button-ub{
width: 63px;
height: 30px;
float: right;
background: #6E92E9;
color: #FFFFFF;
cursor: pointer;
opacity: 1;
border-radius: 2px;
display: flex;
justify-content: center;
align-items: center;

border: 1px solid #6E92E9;
}
.checkbox-A{
 height: 35px !important;
 margin-left: 2px;
}

</style>

<style>
    .editor {
    line-height: normal !important;
    height: 500px;
  }
  .ql-snow .ql-tooltip[data-mode=link]::before {
    content: "请输入链接地址:";
  }
  .ql-snow .ql-tooltip.ql-editing a.ql-action::after {
      border-right: 0px;
      content: '保存';
      padding-right: 0px;
  }

  .ql-snow .ql-tooltip[data-mode=video]::before {
      content: "请输入视频地址:";
  }

  .ql-snow .ql-picker.ql-size .ql-picker-label::before,
  .ql-snow .ql-picker.ql-size .ql-picker-item::before {
    content: '14px';
  }
  .ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]::before,
  .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before {
    content: '10px';
  }
  .ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]::before,
  .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before {
    content: '18px';
  }
  .ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]::before,
  .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before {
    content: '32px';
  }

  .ql-snow .ql-picker.ql-header .ql-picker-label::before,
  .ql-snow .ql-picker.ql-header .ql-picker-item::before {
    content: '文本';
  }
  .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
  .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
    content: '标题1';
  }
  .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
  .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
    content: '标题2';
  }
  .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
  .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
    content: '标题3';
  }
  .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before,
  .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before {
    content: '标题4';
  }
  .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before,
  .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before {
    content: '标题5';
  }
  .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before,
  .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before {
    content: '标题6';
  }

  .ql-snow .ql-picker.ql-font .ql-picker-label::before,
  .ql-snow .ql-picker.ql-font .ql-picker-item::before {
    content: '标准字体';
  }
  .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]::before,
  .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before {
    content: '衬线字体';
  }
  .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]::before,
  .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before {
    content: '等宽字体';
  }
</style>
